package Gather.MapExercise.ArgsDome;

/**
 * ClassName:Args002
 * Package:Gather.MapExercise.ArgsDome
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/21-19:36
 * @Version:v1.0
 */
public class Args002 {
    public static void main(String[] args) {
        //计算n个数据的和
        int[] arr = {1, 2, 3, 4, 5, 6};
        int sum = getSum(arr);
        System.out.println(sum);
    }

    public static int getSum(int[] arr) {
        int sum = 0;
        for (int i : arr) {
            sum += i;
        }
        return sum;
    }
}
